import service from "../index";
// 得到共享目录
const getSmbDirectory = (param) => {
    return new Promise((resolve, reject) => {
        resolve(res);
    });
    


};

// 得到共享文件列表
const getSmbFileList = (param) => {
  return service.post("/apw/doc/get-smbfile", param);
};

// 查询共享目录信息
const querySmbInfo = () => {
  return service.post("/apw/doc/query-smbinfo");
};

// 保存共享目录信息
const saveSmbInfo = (param) => {
  return service.post("/apw/doc/save-smbinfo", param);
};

// 删除共享目录信息
const deleteSmbInfo = (param) => {
  return service.get("/apw/doc/delete-smbinfo", { params: { id: param } });
};

// 获得系统盘符
const getSystemDrive = () => {
  return service.post("/apw/doc/get-drive");
};

// 保存文档目录信息
const saveFileInfo = (param) => {
  return service.post("/api/Department/CreateDirectory", param);
};

// 删除文档目录信息
const deleteFileInfo = (param) => {
  return service.post("/api/Department/DeleteDirectory", param);
};

// 得到文档目录
const getFileDirectory = (param) => {
  return service.post("/apw/doc/get-filedir", param);
};

// 得到文件列表
const getFileList = (param) => {
  return service.post("/api/Department/GetDirectoryFiles", param);
};

// 查询文档目录信息
const queryFileInfo = (data) => {
  return service({
    method: "POST",
    url: `/api/Department/GetDirectories`,
    data,
  });

};

// 查询文档关键词
const queryFileKeywords = () => {
  return service.post("/apw/doc/query-filekeywords");
};

// 保存文档关键字
const saveFileKeywords = (param) => {
  return service.post("/apw/doc/save-filekeywords", param);
};

// 查询关键词options
const queryKeywordsOptions = () => {
  return service.post("/apw/doc/query-keywords-options");
};

// 上传文件
const uploadDocFile = (param) => {
  return service.post("/apw/doc/upload-docfile", param);
};

// 删除文件
const deleteDocFile = (params) => {
  return service({
    method: "GET",
    url: `/api/Department/DeleteShareFile`,
    params,
  });

};

// 重命名子目录
const renameSubdirectory = (param) => {
  return service.post("/apw/doc/rename-subdir", param);
};


 const DownloadDepartmentFile = (params) => {
  return service({
    method: "GET",
    url: `/api/Department/DownloadDepartmentFile`,
    params,
    responseType: "blob",
  });
};


const GetDirectory = (params) => {
  return service({
    method: "GET",
    url: `/api/Department/GetDirectory`,
    params,
    
  });
};

export default {


  GetDirectory,
  DownloadDepartmentFile,
  getSmbDirectory,
  getSmbFileList,
  querySmbInfo,
  saveSmbInfo,
  deleteSmbInfo,
  getSystemDrive,
  saveFileInfo,
  deleteFileInfo,
  getFileDirectory,
  getFileList,
  queryFileInfo,
  queryFileKeywords,
  saveFileKeywords,
  queryKeywordsOptions,
  uploadDocFile,
  deleteDocFile,
  renameSubdirectory,
};
